<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>chptrs.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CHPTRS.1"></a><a href="chptrs.f.html#CHPTRS.1">CHPTRS</a>( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      CHARACTER          UPLO
      INTEGER            INFO, LDB, N, NRHS
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      INTEGER            IPIV( * )
      COMPLEX            AP( * ), B( LDB, * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CHPTRS.19"></a><a href="chptrs.f.html#CHPTRS.1">CHPTRS</a> solves a system of linear equations A*X = B with a complex
</span><span class="comment">*</span><span class="comment">  Hermitian matrix A stored in packed format using the factorization
</span><span class="comment">*</span><span class="comment">  A = U*D*U**H or A = L*D*L**H computed by <a name="CHPTRF.21"></a><a href="chptrf.f.html#CHPTRF.1">CHPTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  UPLO    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          Specifies whether the details of the factorization are stored
</span><span class="comment">*</span><span class="comment">          as an upper or lower triangular matrix.
</span><span class="comment">*</span><span class="comment">          = 'U':  Upper triangular, form is A = U*D*U**H;
</span><span class="comment">*</span><span class="comment">          = 'L':  Lower triangular, form is A = L*D*L**H.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The order of the matrix A.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  NRHS    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of right hand sides, i.e., the number of columns
</span><span class="comment">*</span><span class="comment">          of the matrix B.  NRHS &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  AP      (input) COMPLEX array, dimension (N*(N+1)/2)
</span><span class="comment">*</span><span class="comment">          The block diagonal matrix D and the multipliers used to
</span><span class="comment">*</span><span class="comment">          obtain the factor U or L as computed by <a name="CHPTRF.41"></a><a href="chptrf.f.html#CHPTRF.1">CHPTRF</a>, stored as a
</span><span class="comment">*</span><span class="comment">          packed triangular matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  IPIV    (input) INTEGER array, dimension (N)
</span><span class="comment">*</span><span class="comment">          Details of the interchanges and the block structure of D
</span><span class="comment">*</span><span class="comment">          as determined by <a name="CHPTRF.46"></a><a href="chptrf.f.html#CHPTRF.1">CHPTRF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  B       (input/output) COMPLEX array, dimension (LDB,NRHS)
</span><span class="comment">*</span><span class="comment">          On entry, the right hand side matrix B.
</span><span class="comment">*</span><span class="comment">          On exit, the solution matrix X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDB     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array B.  LDB &gt;= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0:  successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX            ONE
      PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            UPPER
      INTEGER            J, K, KC, KP
      REAL               S
      COMPLEX            AK, AKM1, AKM1K, BK, BKM1, DENOM
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.72"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL           <a name="LSAME.73"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           CGEMV, CGERU, <a name="CLACGV.76"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>, CSSCAL, CSWAP, <a name="XERBLA.76"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          CONJG, MAX, REAL
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      UPPER = <a name="LSAME.84"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'U'</span> )
      IF( .NOT.UPPER .AND. .NOT.<a name="LSAME.85"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( UPLO, <span class="string">'L'</span> ) ) THEN
         INFO = -1
      ELSE IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( NRHS.LT.0 ) THEN
         INFO = -3
      ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
         INFO = -7
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.95"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CHPTRS.95"></a><a href="chptrs.f.html#CHPTRS.1">CHPTRS</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span>      IF( N.EQ.0 .OR. NRHS.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span>      IF( UPPER ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Solve A*X = B, where A = U*D*U'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        First solve U*D*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        K is the main loop index, decreasing from N to 1 in steps of
</span><span class="comment">*</span><span class="comment">        1 or 2, depending on the size of the diagonal blocks.
</span><span class="comment">*</span><span class="comment">
</span>         K = N
         KC = N*( N+1 ) / 2 + 1
   10    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        If K &lt; 1, exit from loop.
</span><span class="comment">*</span><span class="comment">
</span>         IF( K.LT.1 )
     $      GO TO 30
<span class="comment">*</span><span class="comment">
</span>         KC = KC - K
         IF( IPIV( K ).GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           1 x 1 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K and IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = IPIV( K )
            IF( KP.NE.K )
     $         CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(U(K)), where U(K) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in column K of A.
</span><span class="comment">*</span><span class="comment">
</span>            CALL CGERU( K-1, NRHS, -ONE, AP( KC ), 1, B( K, 1 ), LDB,
     $                  B( 1, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by the inverse of the diagonal block.
</span><span class="comment">*</span><span class="comment">
</span>            S = REAL( ONE ) / REAL( AP( KC+K-1 ) )
            CALL CSSCAL( NRHS, S, B( K, 1 ), LDB )
            K = K - 1
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           2 x 2 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K-1 and -IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = -IPIV( K )
            IF( KP.NE.K-1 )
     $         CALL CSWAP( NRHS, B( K-1, 1 ), LDB, B( KP, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(U(K)), where U(K) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in columns K-1 and K of A.
</span><span class="comment">*</span><span class="comment">
</span>            CALL CGERU( K-2, NRHS, -ONE, AP( KC ), 1, B( K, 1 ), LDB,
     $                  B( 1, 1 ), LDB )
            CALL CGERU( K-2, NRHS, -ONE, AP( KC-( K-1 ) ), 1,
     $                  B( K-1, 1 ), LDB, B( 1, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by the inverse of the diagonal block.
</span><span class="comment">*</span><span class="comment">
</span>            AKM1K = AP( KC+K-2 )
            AKM1 = AP( KC-1 ) / AKM1K
            AK = AP( KC+K-1 ) / CONJG( AKM1K )
            DENOM = AKM1*AK - ONE
            DO 20 J = 1, NRHS
               BKM1 = B( K-1, J ) / AKM1K
               BK = B( K, J ) / CONJG( AKM1K )
               B( K-1, J ) = ( AK*BKM1-BK ) / DENOM
               B( K, J ) = ( AKM1*BK-BKM1 ) / DENOM
   20       CONTINUE
            KC = KC - K + 1
            K = K - 2
         END IF
<span class="comment">*</span><span class="comment">
</span>         GO TO 10
   30    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Next solve U'*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        K is the main loop index, increasing from 1 to N in steps of
</span><span class="comment">*</span><span class="comment">        1 or 2, depending on the size of the diagonal blocks.
</span><span class="comment">*</span><span class="comment">
</span>         K = 1
         KC = 1
   40    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        If K &gt; N, exit from loop.
</span><span class="comment">*</span><span class="comment">
</span>         IF( K.GT.N )
     $      GO TO 50
<span class="comment">*</span><span class="comment">
</span>         IF( IPIV( K ).GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           1 x 1 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(U'(K)), where U(K) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in column K of A.
</span><span class="comment">*</span><span class="comment">
</span>            IF( K.GT.1 ) THEN
               CALL <a name="CLACGV.203"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
               CALL CGEMV( <span class="string">'Conjugate transpose'</span>, K-1, NRHS, -ONE, B,
     $                     LDB, AP( KC ), 1, ONE, B( K, 1 ), LDB )
               CALL <a name="CLACGV.206"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K and IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = IPIV( K )
            IF( KP.NE.K )
     $         CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
            KC = KC + K
            K = K + 1
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           2 x 2 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(U'(K+1)), where U(K+1) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in columns K and K+1 of A.
</span><span class="comment">*</span><span class="comment">
</span>            IF( K.GT.1 ) THEN
               CALL <a name="CLACGV.224"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
               CALL CGEMV( <span class="string">'Conjugate transpose'</span>, K-1, NRHS, -ONE, B,
     $                     LDB, AP( KC ), 1, ONE, B( K, 1 ), LDB )
               CALL <a name="CLACGV.227"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span>               CALL <a name="CLACGV.229"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K+1, 1 ), LDB )
               CALL CGEMV( <span class="string">'Conjugate transpose'</span>, K-1, NRHS, -ONE, B,
     $                     LDB, AP( KC+K ), 1, ONE, B( K+1, 1 ), LDB )
               CALL <a name="CLACGV.232"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K+1, 1 ), LDB )
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K and -IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = -IPIV( K )
            IF( KP.NE.K )
     $         CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
            KC = KC + 2*K + 1
            K = K + 2
         END IF
<span class="comment">*</span><span class="comment">
</span>         GO TO 40
   50    CONTINUE
<span class="comment">*</span><span class="comment">
</span>      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Solve A*X = B, where A = L*D*L'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        First solve L*D*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        K is the main loop index, increasing from 1 to N in steps of
</span><span class="comment">*</span><span class="comment">        1 or 2, depending on the size of the diagonal blocks.
</span><span class="comment">*</span><span class="comment">
</span>         K = 1
         KC = 1
   60    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        If K &gt; N, exit from loop.
</span><span class="comment">*</span><span class="comment">
</span>         IF( K.GT.N )
     $      GO TO 80
<span class="comment">*</span><span class="comment">
</span>         IF( IPIV( K ).GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           1 x 1 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K and IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = IPIV( K )
            IF( KP.NE.K )
     $         CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(L(K)), where L(K) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in column K of A.
</span><span class="comment">*</span><span class="comment">
</span>            IF( K.LT.N )
     $         CALL CGERU( N-K, NRHS, -ONE, AP( KC+1 ), 1, B( K, 1 ),
     $                     LDB, B( K+1, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by the inverse of the diagonal block.
</span><span class="comment">*</span><span class="comment">
</span>            S = REAL( ONE ) / REAL( AP( KC ) )
            CALL CSSCAL( NRHS, S, B( K, 1 ), LDB )
            KC = KC + N - K + 1
            K = K + 1
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           2 x 2 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K+1 and -IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = -IPIV( K )
            IF( KP.NE.K+1 )
     $         CALL CSWAP( NRHS, B( K+1, 1 ), LDB, B( KP, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(L(K)), where L(K) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in columns K and K+1 of A.
</span><span class="comment">*</span><span class="comment">
</span>            IF( K.LT.N-1 ) THEN
               CALL CGERU( N-K-1, NRHS, -ONE, AP( KC+2 ), 1, B( K, 1 ),
     $                     LDB, B( K+2, 1 ), LDB )
               CALL CGERU( N-K-1, NRHS, -ONE, AP( KC+N-K+2 ), 1,
     $                     B( K+1, 1 ), LDB, B( K+2, 1 ), LDB )
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by the inverse of the diagonal block.
</span><span class="comment">*</span><span class="comment">
</span>            AKM1K = AP( KC+1 )
            AKM1 = AP( KC ) / CONJG( AKM1K )
            AK = AP( KC+N-K+1 ) / AKM1K
            DENOM = AKM1*AK - ONE
            DO 70 J = 1, NRHS
               BKM1 = B( K, J ) / CONJG( AKM1K )
               BK = B( K+1, J ) / AKM1K
               B( K, J ) = ( AK*BKM1-BK ) / DENOM
               B( K+1, J ) = ( AKM1*BK-BKM1 ) / DENOM
   70       CONTINUE
            KC = KC + 2*( N-K ) + 1
            K = K + 2
         END IF
<span class="comment">*</span><span class="comment">
</span>         GO TO 60
   80    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Next solve L'*X = B, overwriting B with X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        K is the main loop index, decreasing from N to 1 in steps of
</span><span class="comment">*</span><span class="comment">        1 or 2, depending on the size of the diagonal blocks.
</span><span class="comment">*</span><span class="comment">
</span>         K = N
         KC = N*( N+1 ) / 2 + 1
   90    CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        If K &lt; 1, exit from loop.
</span><span class="comment">*</span><span class="comment">
</span>         IF( K.LT.1 )
     $      GO TO 100
<span class="comment">*</span><span class="comment">
</span>         KC = KC - ( N-K+1 )
         IF( IPIV( K ).GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           1 x 1 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(L'(K)), where L(K) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in column K of A.
</span><span class="comment">*</span><span class="comment">
</span>            IF( K.LT.N ) THEN
               CALL <a name="CLACGV.350"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
               CALL CGEMV( <span class="string">'Conjugate transpose'</span>, N-K, NRHS, -ONE,
     $                     B( K+1, 1 ), LDB, AP( KC+1 ), 1, ONE,
     $                     B( K, 1 ), LDB )
               CALL <a name="CLACGV.354"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K and IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = IPIV( K )
            IF( KP.NE.K )
     $         CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
            K = K - 1
         ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           2 x 2 diagonal block
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Multiply by inv(L'(K-1)), where L(K-1) is the transformation
</span><span class="comment">*</span><span class="comment">           stored in columns K-1 and K of A.
</span><span class="comment">*</span><span class="comment">
</span>            IF( K.LT.N ) THEN
               CALL <a name="CLACGV.371"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
               CALL CGEMV( <span class="string">'Conjugate transpose'</span>, N-K, NRHS, -ONE,
     $                     B( K+1, 1 ), LDB, AP( KC+1 ), 1, ONE,
     $                     B( K, 1 ), LDB )
               CALL <a name="CLACGV.375"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K, 1 ), LDB )
<span class="comment">*</span><span class="comment">
</span>               CALL <a name="CLACGV.377"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K-1, 1 ), LDB )
               CALL CGEMV( <span class="string">'Conjugate transpose'</span>, N-K, NRHS, -ONE,
     $                     B( K+1, 1 ), LDB, AP( KC-( N-K ) ), 1, ONE,
     $                     B( K-1, 1 ), LDB )
               CALL <a name="CLACGV.381"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( NRHS, B( K-1, 1 ), LDB )
            END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Interchange rows K and -IPIV(K).
</span><span class="comment">*</span><span class="comment">
</span>            KP = -IPIV( K )
            IF( KP.NE.K )
     $         CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
            KC = KC - ( N-K+2 )
            K = K - 2
         END IF
<span class="comment">*</span><span class="comment">
</span>         GO TO 90
  100    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CHPTRS.399"></a><a href="chptrs.f.html#CHPTRS.1">CHPTRS</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
